﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using SEO.Business;
using SEO.Entity;

public partial class Main : AdminPage
{
    /// <summary>
    /// 页面初始化
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            lblName.Text = strAdminName == string.Empty ? strAdminUserName : strAdminName;
            lblDay.Text = DateTime.Now.ToString("yyyy年MM月dd日");
            
            //权限
            if (nAdminFeatures != 1)
            {
                bool bTag = false;
                #region SEO收录情况
                if (SupportFeatures(AdminFEATURE.KeywordsSEO))
                {
                    KeywordsSEO.Visible = true;
                    bTag = true;
                }

                if (SupportFeatures(AdminFEATURE.ArticleSEO))
                {
                    ArticleSEO.Visible = true;
                    bTag = true;
                }

                if (SupportFeatures(AdminFEATURE.NewsWebSEOList))
                {
                    NewsWebSEOList.Visible = true;
                    bTag = true;
                }

                if (SupportFeatures(AdminFEATURE.NewsWebSEO))
                {
                    NewsWebSEOList.Visible = true;
                    bTag = true;
                }

                if (bTag)
                {
                    SEOPanelTitle.Visible = true;
                    SEOPanel.Visible = true;
                }
                #endregion

                #region 统计管理
                bTag = false;
                if (SupportFeatures(AdminFEATURE.KeywordsReport))
                {
                    KeywordsReport.Visible = true;
                    bTag = true;
                }

                if (SupportFeatures(AdminFEATURE.ArticleTypeReportList))
                {
                    ArticleTypeReportList.Visible = true;
                    bTag = true;
                }

                if (SupportFeatures(AdminFEATURE.ArticleReport))
                {
                    ArticleReport.Visible = true;
                    bTag = true;
                }

                if (SupportFeatures(AdminFEATURE.UserArticleReportList))
                {
                    UserArticleReportList.Visible = true;
                    bTag = true;
                }

                if (bTag)
                {
                    ReportPanelTitle.Visible = true;
                    ReportPanel.Visible = true;
                }
                #endregion

                #region SEO配置
                bTag = false;
                if (SupportFeatures(AdminFEATURE.Sort))
                {
                    Sort.Visible = true;
                    bTag = true;
                }

                if (SupportFeatures(AdminFEATURE.KeywordsList))
                {
                    KeywordsList.Visible = true;
                    bTag = true;
                }

                if (SupportFeatures(AdminFEATURE.TodayKeywordsList))
                {
                    TodayKeywordsList.Visible = true;
                    bTag = true;
                }

                if (SupportFeatures(AdminFEATURE.MedicalList))
                {
                    MedicalList.Visible = true;
                    bTag = true;
                }

                if (SupportFeatures(AdminFEATURE.NewsWebList))
                {
                    NewsWebList.Visible = true;
                    bTag = true;
                }

                if (SupportFeatures(AdminFEATURE.OurWebList))
                {
                    OurWebList.Visible = true;
                    bTag = true;
                }

                if (SupportFeatures(AdminFEATURE.DeductWebList))
                {
                    DeductWebList.Visible = true;
                    bTag = true;
                }

                if (SupportFeatures(AdminFEATURE.FilterWebList))
                {
                    FilterWebList.Visible = true;
                    bTag = true;
                }

                if (bTag)
                {
                    SEOConfigPanelTitle.Visible = true;
                    SEOConfigPanel.Visible = true;
                }
                #endregion

                #region 用户管理
                bTag = false;
                if (SupportFeatures(AdminFEATURE.UserType))
                {
                    UserType.Visible = true;
                    bTag = true;
                }

                if (SupportFeatures(AdminFEATURE.UserList))
                {
                    UserList.Visible = true;
                    bTag = true;
                }

                if (bTag)
                {
                    UserPanelTitle.Visible = true;
                    UserPanel.Visible = true;
                }
                #endregion

                #region 其他管理
                bTag = false;
                if (SupportFeatures(AdminFEATURE.SysConfig))
                {
                    SysConfig.Visible = true;
                  //  bTag = true;
                }

                if (SupportFeatures(AdminFEATURE.SysRunLogList))
                {
                    SysRunLogList.Visible = true;
                   // bTag = true;
                }

                if (SupportFeatures(AdminFEATURE.EditPassword))
                {
                    EditPassword.Visible = true;
                   // bTag = true;
                }
                //if (bTag)
                //{
                //    OtherPanelTitle.Visible = true;
                //    OtherPanel.Visible = true;
                //}
                #endregion
            }
            else if (nAdminFeatures == 1)
            {
                SEOPanelTitle.Visible = true;
                SEOPanel.Visible = true;
                KeywordsSEO.Visible = true;
                ArticleSEO.Visible = true;
                NewsWebSEOList.Visible = true;

                ReportPanelTitle.Visible = true;
                ReportPanel.Visible = true;
                KeywordsReport.Visible = true;
                ArticleReport.Visible = true;
                UserArticleReportList.Visible = true;
                ArticleTypeReportList.Visible = true;

                SEOConfigPanelTitle.Visible = true;
                SEOConfigPanel.Visible = true;
                Sort.Visible = true;
                KeywordsList.Visible = true;
                TodayKeywordsList.Visible = true;
                MedicalList.Visible = true;
                NewsWebList.Visible = true;
                OurWebList.Visible = true;
                DeductWebList.Visible = true;
                FilterWebList.Visible = true;

                UserPanelTitle.Visible = true;
                UserPanel.Visible = true;
                UserType.Visible = true;
                UserList.Visible = true;

                OtherPanelTitle.Visible = true;
                OtherPanel.Visible = true;
                SysConfig.Visible = true;
                SysRunLogList.Visible = true;
                EditPassword.Visible = true;
            }
        }
    }
}
